
// utility.h
#ifndef _76801018_c11a_4f37_9b8d_94a85b1f2187__UTILITY_H__
#define _76801018_c11a_4f37_9b8d_94a85b1f2187__UTILITY_H__

#include <windows.h>

static bool wchar_tTochar( const wchar_t* in,char* out,unsigned long outSize )
{
	if(in == NULL) return false;
	int lens = WideCharToMultiByte(CP_OEMCP,NULL,in,-1,NULL,0,NULL,FALSE);
	if (lens > (int)outSize) return false;
	WideCharToMultiByte(CP_OEMCP,NULL,in,-1,out,lens,NULL,FALSE);
	return true;
}

static bool charTowchar_t(const char* in,wchar_t* out,unsigned long outSize)
{
	if(in == NULL) return false;
	int lens = MultiByteToWideChar(CP_ACP,0,in,-1,NULL,0);
	if (lens > (int)outSize) return false;
	MultiByteToWideChar(CP_ACP,0,in,-1,out,lens);
	return true;
}

	template<typename T> inline const T& minVal(const T& x, const T& y) {
		return x < y ? x : y;
	};

	template<typename T> inline const T& maxVal(const T& x, const T& y) {
		return x > y ? x : y;
	};

#endif //_76801018_c11a_4f37_9b8d_94a85b1f2187__UTILITY_H__